﻿<cfsilent>
	<cfscript>
		
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		
		termId = event.getArg("TermID");
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		taskId = event.getArg("TSK");
		taskType = event.getArg("TT");
		
		roomId = event.getArg("CLSROOM");
		
		targetWeek = event.getArg("W");
		taskTime = event.getArg("TSKTIME");
		taskRoom = event.getArg("TSKROOM");
				
		weekDay = listGetAt(taskTime, 1, "-@");
		lectureId = listGetAt(taskTime, 2, "-@");
		cells = listGetAt(taskTime, 3, "-@");
		
		passArgs = structNew();
		structInsert( passArgs, "TSK", taskId );
		structInsert( passArgs, "TT", taskType );
		structInsert( passArgs, "TID", termId );
		structInsert( passArgs, "W", targetWeek );
		structInsert( passArgs, "CLSROOM", roomId );
		structInsert( passArgs, "TSKTIME", taskTime );
		
		switch(taskType){
			case "C":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite,
							t_course.cid 
						FROM 
							t_common_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;

			case "P":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite, 
							a.task_classes, 
							t_course.cid 
						FROM 
							t_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
			
			case "R":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite, 
							t_course.cid 
						FROM 
							t_reopen_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
			
			case "T":
				sql = "SELECT 
							t_course.course_name, 
							a.task_week, 
							t_teacher.tch_name, 
							t_institute.institute_name, 
							t_course.period, 
							t_course.period_theory, 
							t_course.course_credit, 
							t_teacher.tch_id, 
							a.task_period, 
							a.task_desc, 
							t_campus.campus_name, 
							t_classroom_type.cr_type_name, 
							a.task_chooesd, 
							a.task_limite, 
							t_course.cid 
						FROM 
							t_sport_task a 
							INNER JOIN t_course ON t_course.cid = a.cid 
							INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
							INNER JOIN t_teacher ON t_teacher.tch_id = a.tch_id 
							INNER JOIN t_campus ON t_campus.campus_id = a.campus_id 
							INNER JOIN t_classroom_type ON t_classroom_type.cr_type = a.cr_type 
						WHERE 
							a.tsk_id = :taskId ";
				break;
		}
		
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="taskId", value=taskId, cfsqltype="cf_sql_varchar" );
		rs_task = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT classroom FROM t_classroom WHERE cr_id = :classroomID ";
		
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="classroomID", value=roomId, cfsqltype="cf_sql_char" );
		rs_classroom = queryObj.execute( sql=sql ).getResult();

		event.setArg("pageTitle", "教学任务安排 - 临时调换教室 - " & rs_task.course_name );
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('taskTempChange')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">临时调停课</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>临时调换教室 <cfoutput>#rs_task.course_name#</cfoutput>-<cfoutput>#rs_task.tch_name#</cfoutput> 
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
			
				<div class="noticeBlock">
					<h3>《<cfoutput>#rs_task.course_name#</cfoutput>》 任课单位: <cfoutput>#rs_task.institute_name#</cfoutput></h3>
					<p><span class="img icon16x16 message"></span>总学时 <em><cfoutput>#rs_task.period#</cfoutput></em>, 其中理论学时 <em><cfoutput>#rs_task.period_theory#</cfoutput></em>. 课程总学分:<em><cfoutput>#numberFormat(rs_task.course_credit, '_.00')#</cfoutput></em> 主讲教师: <cfoutput>#rs_task.tch_name#</cfoutput><em>(<cfoutput>#rs_task.tch_id#</cfoutput>)</em> 排课周次: <em><cfoutput>#rs_task.task_week#</cfoutput></em> 周学时: <em><cfoutput>#rs_task.task_period#</cfoutput></em> </p>
					<cfif rs_task.task_desc neq "">
						<p><span class="img icon16x16 message"></span>排课要求: <cfoutput>#rs_task.task_desc#</cfoutput> </p>
					</cfif>
					<p><span class="img icon16x16 building"></span> 校区: <cfoutput>#rs_task.campus_name#</cfoutput> 教学场地: <cfoutput>#rs_task.cr_type_name#</cfoutput> 实际人数: <em><cfoutput>#rs_task.task_chooesd#</cfoutput></em> 计划人数: <em><cfoutput>#rs_task.task_limite#</cfoutput></em>
					<cfif taskType eq "P">
						<span class="img icon16x16 card"></span> 排课班级: <cfoutput>#rs_task.task_classes#</cfoutput>
					</cfif>
					</p>
					<hr/>
				</div>

				<form id="formSign" onSubmit="javascript:return processVerfiyForm('formSign');" class="formWrapper " method="post" action="<cfoutput>#buildURL('taskChangeWizardPlaceSignDo')#</cfoutput>">
					
					<input name="CourseID" id="CourseID" type="hidden" value="<cfoutput>#rs_task.cid#</cfoutput>" />
					<input name="TeacherID" id="TeacherID" type="hidden" value="<cfoutput>#rs_task.tch_id#</cfoutput>" />
					
					<input name="ClassroomID" type="hidden" value="<cfoutput>#roomId#</cfoutput>" />
					<input name="TaskID" type="hidden" value="<cfoutput>#taskId#</cfoutput>" />
					<input name="TaskType" type="hidden" value="<cfoutput>#taskType#</cfoutput>" />
					<input name="WeekID" type="hidden" value="<cfoutput>#targetWeek#</cfoutput>" />
					<input name="TaskTime" type="hidden" value="<cfoutput>#taskTime#</cfoutput>" />
					<input name="TermID" type="hidden" value="<cfoutput>#termId#</cfoutput>" />

					<input name="ChangeTarget" type="hidden" value="<cfoutput>#targetWeek#</cfoutput>|<cfoutput>#taskTime#</cfoutput>|<cfoutput>#roomId#</cfoutput>" />
					<input name="ChangeDescription" id="ChangeDescription" type="hidden" value="第<cfoutput>#targetWeek#</cfoutput>周，<cfoutput>#mathAdvice.convertTaskTime(taskTime)#</cfoutput>更换上课地点，由 <cfoutput>#taskRoom#</cfoutput> 更换到 <cfoutput>#rs_classroom.classroom#</cfoutput>。" />
					
					<input name="wkday" type="hidden" value="<cfoutput>#weekDay#</cfoutput>" />
					<input name="lec" type="hidden" value="<cfoutput>#lectureId#</cfoutput>" />
					<input name="n" type="hidden" value="<cfoutput>#cells#</cfoutput>" />
					
					<div class="label">
						<span class="req">*</span><b>课程</b>
						<p><cfoutput>#rs_task.course_name#</cfoutput></p>
					</div>
					
					<div class="label">
						<span class="req">*</span><b>主讲教师</b>
						<p><cfoutput>#rs_task.tch_name#</cfoutput></p>
					</div>

					<div class="label">
						<b>挽教室内容描述</b>
						<p>第<cfoutput>#targetWeek#</cfoutput>周，<cfoutput>#mathAdvice.convertTaskTime(taskTime)#</cfoutput>更换上课地点，由 <cfoutput>#taskRoom#</cfoutput> 更换到 <cfoutput>#rs_classroom.classroom#</cfoutput>。</p>
					</div>

					<hr/>
						
					<div class="lable">
						<input class="button1" type="submit" value="执行地点变更" />
					</div>

				</form>
				
			
			</div>
		</li>
	</ul>
</div>

